import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: '首页',
    meta: { title: '首页', icon: 'example' },
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },

  {
    path: '/reserve',
    component: Layout,
    redirect: '/reserve/table',
    name: '预约管理',
    meta: { title: '预约管理', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '预约列表',
        component: () => import('@/views/reserve/list'),
        meta: { title: '预约列表', icon: 'table' }
      },
      {
        path: 'add',
        name: '在线挂号',
        component: () => import('@/views/reserve/add'),
        meta: { title: '在线挂号', icon: 'tree' }
      },

      {
        path: 'edit/:id',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/reserve/add'),
        meta: { title: '编辑', noCache: true },
        hidden: true
      },
    ]
  },

  {
    path: '/diagnosis',
    component: Layout,
    redirect: '/diagnosis/table',
    name: '诊断病历',
    meta: { title: '诊断病历', icon: 'table' },
    children: [
      {
        path: 'list',
        name: '宠物病历管理',
        component: () => import('@/views/diagnosis/list'),
        meta: { title: '宠物病历管理', icon: 'table' }
      },
      {
        path: 'add',
        name: '在线挂号',
        component: () => import('@/views/diagnosis/updateDiagnosis'),
        meta: { title: '在线挂号', icon: 'tree' },
        hidden: true
      },
      {
        path: 'edit/:id',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/diagnosis/updateDiagnosis'),
        meta: { title: '编辑', noCache: true },
        hidden: true
      },
    ]
  },

  {
    path: '/petInformation',
    component: Layout,
    redirect: '/petInformation/table',
    name: '宠物管理',
    meta: { title: '宠物管理', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '宠物体检管理',
        component: () => import('@/views/petInformation/list'),
        meta: { title: '宠物体检管理', icon: 'table' }
      },
      {
        path: 'add/:userId/:petType',
        name: '宠物体检信息添加',
        component: () => import('@/views/petInformation/add'),
        meta: { title: '宠物体检信息添加', noCache: true },
        hidden: true
      },
      {
        path: 'edit/:id',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/petInformation/add'),
        meta: { title: '编辑', noCache: true },
        hidden: true
      },
      {
        path: 'chart/:id',
        name: 'chart',
        component: () =>import('@/views/petInformation/chart'),
        meta: { title: '宠物健康指标分析', noCache: true },
       hidden: true
      },
    ]
  },

  {
    path: '/notice',
    component: Layout,
    redirect: '/notice/table',
    name: '医院管理',
    meta: { title: '医院管理', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '公告列表',
        component: () => import('@/views/notice/list'),
        meta: { title: '公告列表', icon: 'table' }
      },
      {
        path: 'add',
        name: '公告添加',
        component: () => import('@/views/notice/add'),
        meta: { title: '公告添加', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/notice/add'),
        meta: { title: '编辑', noCache: true },
        hidden: true
      },
      {
        path: 'chart',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/statistical/chart'),
        meta: { title: '预约数据统计', icon: 'example' },
      },
    ]
  },

  {
    path: '/staff',
    component: Layout,
    redirect: '/staff/table',
    name: '员工管理',
    meta: { title: '员工管理', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '员工列表',
        component: () => import('@/views/staff/list'),
        meta: { title: '员工列表', icon: 'table' }
      },
      {
        path: 'add',
        name: '员工添加',
        component: () => import('@/views/staff/add'),
        meta: { title: '员工添加', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/staff/add'),
        meta: { title: '编辑', noCache: true },
        hidden: true
      },
    ]
  },

  {
    path: '/user',
    component: Layout,
    redirect: '/user/table',
    name: '用户管理',
    meta: { title: '用户管理', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '用户管理',
        component: () => import('@/views/user/list'),
        meta: { title: '用户管理', icon: 'table' }
      },
      {
        path: 'add',
        name: '用户添加',
        component: () => import('@/views/user/add'),
        meta: { title: '用户添加', icon: 'tree' },
        hidden: true
      },
      {
        path: 'edit/:id',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/user/add'),
        meta: { title: '编辑', noCache: true },
        hidden: true
      },
    ]
  },


  {
    path: '/hospitalSet',
    component: Layout,
    redirect: '/hospitalSet/table',
    name: '宠物医院设置管理',
    meta: { title: '宠物医院设置管理', icon: 'example' },
    hidden:true,
    children: [
      {
        path: 'list',
        name: '宠物医院设置列表',
        component: () => import('@/views/hospitalSet/list'),
        meta: { title: '宠物医院设置列表', icon: 'table' }
      },
      {
        path: 'add',
        name: '宠物医院设置添加',
        component: () => import('@/views/hospitalSet/add'),
        meta: { title: '宠物医院设置添加', icon: 'tree' }
      },
      {
        path: 'edit/:id',
        name: 'EduTeacherEdit',
        component: () =>import('@/views/hospitalSet/add'),
        meta: { title: '编辑', noCache: true },
        hidden: true
      },
    ]
  },

  {
    path: '/cmn',
    component: Layout,
    redirect: '/cmn/list',
    name: '数据管理',
    alwaysShow: true,
    meta: { title: '数据管理', icon: 'example' },
    hidden:true,
    children: [
      {
        path: 'list',
        name: '数据字典',
        component: () => import('@/views/dict/list'),
        meta: { title: '数据字典', icon: 'table' },
        hidden:true
      }
    ]
  },

  {
    path: 'external-link',
    component: Layout,
    hidden:true,
    children: [
      {
        path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
        meta: { title: 'External Link', icon: 'link' },
        hidden:true
      }
    ]
  },

  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
